function [exper, npoint, hstart, hend, dhg, freq ] = dataIn(filex)
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here


more = true;
isim = 0;

while more
 % decide whether this is native or ESP380 file
  ext = ' ';
  dot = strfind(filex, '.');
  if isempty(dot) == false
    ext = filex(dot+1:dot+3);
  end
  if ( strcmpi(ext, 'SPC') == true || strcmp(ext, 'spc') == true ) ;
  elseif (strcmpi(ext, 'dta') == true || strcmpi(ext, 'DTA'))      ;
  else
      %Add error message
      if (isim ==9) return;
      end
      more=false;
      fid = fopen(filex, 'r');    
      a = textscan(fid, '%f %f %f %f %f', 1);
      npoint = a{1};
      NC = ceil(npoint/6);
      exper = textscan(fid, '%f %f %f %f %f %f', NC);
      A = exper{1};
      B = exper{2};
      C = exper{3};
      D = exper{4};
      E = exper{5};
      F = exper{6};
      exper = [A'; B'; C'; D'; E'];
      exper = exper(:);
      extraDat = NC*6 - npoint;
      exper = exper(1:end-extraDat);

      para = textscan(fid, '%f', 35);
        
      fclose(fid); 
       
  end
  
      freq = para{1}(9);
      hstart = para{1}(10) - 0.5 * para{1}(27);
      hend = para{1}(10) + 0.5*para{1}(27);
      dhg = para{1}(27)/(npoint-1);
     
display(freq);
  
end

end
  

